﻿function AddCategory(firstCategorySpanId, firstCategoriesSelectId) {
    
    var firstCategorySpan = $('#' + firstCategorySpanId);

    var firstCategorySpanParent = firstCategorySpan.parent(); // parent span
    var valuesCount = firstCategorySpanParent.children().length;
    var clonedCategoriesSelectId1 = 'categorySelect_' + valuesCount;

    var clonedCategorySpan = firstCategorySpan.clone(false);
    clonedCategorySpan.removeAttr('id');
    var clonedCategoriesSelect = clonedCategorySpan.find('#' + firstCategoriesSelectId);

    clonedCategoriesSelect.attr('id', clonedCategoriesSelectId1);
    clonedCategoriesSelect.attr('name', clonedCategoriesSelectId1);
    clonedCategoriesSelect.attr("selectedIndex", 0);

    var clonedCategoriesPropertiesContainer = clonedCategorySpan.children('div:last');
    clonedCategoriesPropertiesContainer.empty();

    firstCategorySpanParent.append(clonedCategorySpan);
}

function RemoveCategoryValue() {

}